<!DOCTYPE html>
{% load static %}
<html lang="ru">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>{{ title }}</title>

    <!-- Bootstrap core CSS -->
    <link href="{% static '/vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">

    {% block css %} {% endblock %}

</head>
<body>

<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
    <div class="container">
        <a class="navbar-brand" href="{% url 'index' %}">Store</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive"
                aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarResponsive">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'products:index' %}">Каталог <i class="fas fa-shopping-bag"></i> </a>
                </li>
                {% if user.is_authenticated %}
                      <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="" id="navbarDropdown" role="button"
                               data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-user-circle"></i>
                            </a>
                            <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <li>
                                    <a class="dropdown-item" href="{% url 'users:profile' user.id %}">Профиль</a>
                                </li>
                                <li><a class="dropdown-item" href="">Заказы</a></li>
                                {% if user.is_superuser or user.is_staff %}
                                    <li><a class="dropdown-item" href="{% url 'admin:index' %}">Админ-панель</a></li>
                                {% endif %}
                                <li>
                                    <hr class="dropdown-divider">
                                </li>
                                <li>
                                    <a class="dropdown-item" href="{% url 'users:logout' %}">
                                        Выйти
                                    </a>
                                </li>
                            </ul>
                        </li>
                {% else %}
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'users:login' %}">Войти <i class="fas fa-sign-in-alt"></i></a>
                    </li>
                {% endif %}

            </ul>
        </div>
    </div>
</nav>

{% block content %}
{% endblock %}

{% block footer %}
{% endblock %}

<!-- Bootstrap core JavaScript -->
<script src="{% static '/vendor/jquery/jquery.min.js' %}"></script>
<script src="{% static '/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
        crossorigin="anonymous"></script>

<!-- FontAwesome script -->
<script src="{% static '/vendor/fontawesome/fontawesome-icons.js' %}" crossorigin="anonymous"></script>

</body>
</html>